function throttle(fn, delay = 1000) {
  let timeOut
  return function (...args) {
    if (!timeOut) {
      timeOut = setTimeout(() => {
        fn.apply(this, args)
        timeOut = null
      }, delay)
    }
  }
}
